home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: oce.nl!not-for-mail!news
- From: qqehe@oce.nl (Emile Heyns)
- Subject: Pointer to non-static method
- X-Nntp-Posting-Host: tg17-pos
- Message-ID: <Dpn2MG.9y0@oce.nl>
- Sender: news@oce.nl (The Daily News @ nntp01.oce.nl)
- Organization: Oce Nederland B.V. - Research & Development
- X-Newsreader: knews 0.9.3
- Date: Wed, 10 Apr 1996 09:06:16 GMT
-
- Hi all,
-
- I am looking for a way to store and use a pointer to a method. I will
- be using this pointer from within another method of the same object
- (I will remain "within" the object). So far, I have been using thus
- kludge:
-
- =====
- class object {
- static object* This;
-
- static void method1(int x, int y);
- static void method2(int x, int y);
-
- void method3(...);
- void method4(...);
- };
-
- object::object(...)
- {
- This = this;
- }
-
- void object::method3(...)
- {
- function_pointer = condition ? method1 : method2;
- }
-
- void object::method1(int x, int y)
- {
- do something with This;
- }
- =====
-
- but this will limit me to instantiating only one object of this class.
- Any ideas?
-
- --
- Bye,
-
- Emile
-
- ===========================================================
- Emile Heyns email: emile.heyns@hta.nl
- ===========================================================
- Disclaimer: the opinions in this messages are *mine*, and
- have *no* bearing whatsoever on the opinions of the company.
- So there.
-
- Never make anything simple and efficient when a way can be found to
- make it complex and wonderful.
-
-